<?php // Set The Field Variables
	global $ssproductid;
	$ssproductid = get_field('sscompareproduct');
	$otherproductname = get_field('othercompareproduct');
	$otherproductprice = get_field('othercompareproductprice');
	
	// Get SS Product Image
	if (get_field('productFeaturedImage') != '') {
                	$otherproductimage = get_field('productFeaturedImage');
                } else {
                	$otherproductimage = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ));
                        $otherproductimage = $ppcompareproducttwoimage[0];
                }

?>

<style>
    .yarpp-related { display:none; }
</style>

<div class="fullproductcomparison">
	<div class="fullproductcomparisonleft">
		<?php // Query For The Silicon Solar Product Via ID#
			$ourproduct = new wp_query('post_type=product&posts_per_page=1&p='.$ssproductid.'');
			while($ourproduct->have_posts()) : $ourproduct->the_post();

				// Get The Regular Price
				$ssproductregularprice = get_post_custom($post->ID);
				$ssproductregprice = $ssproductregularprice['_regular_price'];
				foreach ( $ssproductregprice as $ssproductregprice );

				// Get The Sale Price
				$ssproductsaleprice = get_post_custom($post->ID);
				$ssproductsprice = $ssproductsaleprice['_sale_price'];
				foreach ( $ssproductsprice as $ssproductsprice );

				if($ssproductsprice > 0) {
					$ssproductprice = $ssproductsprice;
				} else {
					$ssproductprice = $ssproductregprice;
				}

				$savingsamount = $otherproductprice - $ssproductprice;
				$savingspercent = $savingsamount / $otherproductprice;
				$savingspercent = $savingspercent * 100;

				// Additional SS Product Variables
				$ssproductlink = get_permalink();

				// Get SS Product Image
				if (get_field('productFeaturedImage') != '') {
								$ssproductimage = get_field('productFeaturedImage');
							} else {
								$ssproductimage = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ));
								$ssproductimage = $ssproductimage[0];
							}

		?>
			<a href="<?php the_permalink(); ?>">
                            <img src="<?php echo $ssproductimage; ?>" alt="<?php the_title(); ?>" style="width:208px;height:208px;margin:0px;margin-bottom:10px;" />
                        </a>
                        <h3 style="text-align:center;"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
			<p style="text-align:center;font-weight:bold;font-style:italic;">Silicon Solar Price</p>
			<?php include '/home/silicons/public_html/wp-content/themes/woostore/woocommerce/single-product/price.php'; ?>
		<?php endwhile; ?>
		<?php wp_reset_query(); ?>
	</div>

	<div class="fullproductcomparisoncenter">
		&nbsp;
	</div>

	<div class="fullproductcomparisonright">
			<img src="<?php echo $otherproductimage; ?>" alt="<?php the_title(); ?>" style="width:208px;height:208px;margin:0px;margin-bottom:10px;" />
			<h3 style="text-align:center;"><?php echo $otherproductname; ?></h3>
			<p style="text-align:center;font-weight:bold;font-style:italic;">Avg. Online Price</p>
			<p class="price" style="text-align:center;">
				<del><span class="amount"></span></del>
				<ins><span class="amount">$<?php echo $otherproductprice; ?></span></ins>
			</p>
	</div>

	<div class="fullproductcomparisontablediv">
		<table width="100%" cellpadding="0" cellspacing="0" border="0" style="font-size:11px;">
			<tr>
				<th style="text-align:center;height:30px;line-height:30px;font-size:12px;font-weight:bold;">
					<?php if($savingspercent > 1) { ?>
						<span class="savings">Save <?php echo round($savingspercent); ?>% With Silicon Solar</span>
					<?php } ?>
				</th>
				<th style="text-align:center;height:30px;line-height:30px;font-size:12px;font-weight:bold;">Features &amp; Specifications</th>
				<th style="text-align:center;height:30px;line-height:30px;font-size:12px;font-weight:bold;"></th>
			</tr>
			<?php while(has_sub_field('compareattributes')) : ?>
				<tr>
					<td style="text-align:center;width:220px;"><?php the_sub_field('sscompareattribute'); ?></td>
					<td style="text-align:center;width:180px;font-style:italic;"><?php the_sub_field('compareattribute'); ?></td>
					<td style="text-align:center;width:220px;"><?php the_sub_field('othercompareattribute'); ?></td>
				</tr>
			<?php endwhile; ?>
		</table>
	</div>

	<div class="fullproductcomparisonleft">
		<a href="<?php echo $ssproductlink; ?>" class="button">View Product</a> <a href="<?php echo $ssproductlink; ?>?add-to-cart=<?php echo $ssproductid; ?>" class="button">Add To Cart</a>
	</div>

	<div class="fullproductcomparisoncenter">
		&nbsp;
	</div>

	<div class="fullproductcomparisonright">
		<span style="font-style:italic;color:#717470;">Not Currenty Available<br>From Silicon Solar</span>
	</div>
</div>